package es

import (
	"fmt"

	"gitee.com/mkwchecking/sr-core/log"
	es "github.com/olivere/elastic/v7"
)

var _ es.Logger = (*esLogger)(nil)

func newEsLogger(level log.Level) *esLogger {
	return &esLogger{
		level: level,
	}
}

type esLogger struct {
	level log.Level
}

// Printf implements elastic.Logger.
func (e *esLogger) Printf(format string, v ...interface{}) {
	log.Log(e.level, fmt.Sprintf(format, v...))
}
